import React from 'react';
// import { formatMessage } from 'umi';
// import { Link }  from 'umi';
import { Icon } from 'antd';
import { GlobalFooter } from 'ant-design-pro';
// import SelectLang from '@/components/SelectLang';
import SimpleBasicLayout from '@/layouts/SimpleBasicLayout';
import simpleLayoutPaths from '@/../config/simpleLayout.config';

import styles from './UserLayout.less';
import logo from '../assets/logo_project.png';

// const links = [
//     {
//         key: 'help',
//         title: formatMessage({ id: 'layout.user.link.help' }),
//         href: ''
//     },
//     {
//         key: 'privacy',
//         title: formatMessage({ id: 'layout.user.link.privacy' }),
//         href: ''
//     },
//     {
//         key: 'terms',
//         title: formatMessage({ id: 'layout.user.link.terms' }),
//         href: ''
//     }
// ];

const copyright = (
    <div className={styles.footer}>
        Copyright <Icon type="copyright" /> 2019 微微科技研发中心
    </div>
);

class UserLayout extends React.PureComponent {
    // @TODO title
    // getPageTitle() {
    //   const { routerData, location } = this.props;
    //   const { pathname } = location;
    //   let title = 'Ant Design Pro';
    //   if (routerData[pathname] && routerData[pathname].name) {
    //     title = `${routerData[pathname].name} - Ant Design Pro`;
    //   }
    //   return title;
    // }

    render() {
        const { children, location } = this.props;
        const layout = () => {
            const simpleConfig = simpleLayoutPaths.find(item => item.path === location.pathname);
            if (simpleConfig?.blank) {
                return <div>{children}</div>;
            }
            if (simpleConfig) {
                return (
                    <SimpleBasicLayout {...this.props} withoutHeader={simpleConfig.withoutHeader}>
                        {children}
                    </SimpleBasicLayout>
                );
            }
            return (
                <div className={styles.container}>
                    {/* <div className={styles.lang}>
                        <SelectLang />
                    </div> */}
                    <div className={styles.content}>
                        <div>
                            <div className={styles.top}>
                                <div className={styles.header}>
                                    {/* <Link to="/"> */}
                                    <img alt="logo" className={styles.logo} src={logo} />
                                    {/* <span className={styles.title}>
                                    微微科技集团管理工具
                                </span> */}
                                    {/* </Link> */}
                                </div>
                                {/* <div className={styles.desc} /> */}
                            </div>
                            {children}
                        </div>
                    </div>
                    <GlobalFooter links={[]} copyright={copyright} />
                </div>
            );
        };
        return layout();
    }
}

export default UserLayout;
